<template>
    <h2>登录页面</h2>
    <table>
        <tr>
            <th>用户名：</th>
            <th>
                <input type="text" placeholder="请输入用户名" v-model="UserName" />
            </th>
        </tr>
        <tr>
            <th>用户密码：</th>
            <th>
                <input type="password" placeholder="请输入用户名" v-model="Password" />
            </th>
        </tr>
        <tr>
            <th>手机号：</th>
            <th>
                <input type="text" placeholder="请输入用户手机号" v-model="Phone" />
            </th>
        </tr>
        <tr>
            <th colspan="2">
                <input type="button" @click="login" value="登录" />
            </th>
        </tr>
    </table>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
const UserName = ref('');
const Password = ref('');
const Phone = ref('');
const login = () => {
    axios.get("http://localhost:53223/api/Tian/ShowLogin", {
        params: {
            name: UserName.value,
            pwd: Password.value
        }
    })
        .then(res => {
            if (res.data != null) {
                alert("恭喜用户{手机号}登录成功！");
                return;
            }
            else {
                alert("登录失败");
                return;
            }
        })
}
</script>